Provide alternate prefix-title for echo area
authorjustbur <justin@burkett.cc>
Thu, 19 Nov 2015 03:00:14 +0000 (22:00 -0500)
committerjustbur <justin@burkett.cc>
Thu, 19 Nov 2015 03:00:14 +0000 (22:00 -0500)
which-key.el

index 490ed7db2775fa0859ddd0d808d7d7ed97cd0e87..aaef402b4593835f779deb2197f4bb488607b118 100644 (file)
@@ -1123,14 +1123,17 @@ An empty stiring is returned if no title exists."
       (let* ((alist which-key-prefix-title-alist)
              (res (assoc key-lst alist))
              (mode-alist (assq major-mode alist))
-             (mode-res (when mode-alist (assoc key-lst mode-alist))))
+             (mode-res (when mode-alist (assoc key-lst mode-alist)))
+             (alternate (when (symbolp (key-binding (apply #'vector key-lst)))
+                          (symbol-name (key-binding (apply #'vector key-lst))))))
         (cond (mode-res (cdr mode-res))
               (res (cdr res))
+              ((and (eq which-key-show-prefix 'echo) alternate)
+               alternate)
               ((and (member which-key-show-prefix '(bottom top))
                     (eq which-key-side-window-location 'bottom)
                     echo-keystrokes)
-               (if (symbolp (key-binding (apply #'vector key-lst)))
-                   (symbol-name (key-binding (apply #'vector key-lst)))
+               (if alternate alternate
                  (concat "Following " (key-description key-lst))))
               (t "")))
     "Top-level bindings"))